<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登陆注册</title>
	<link rel="stylesheet" href="__CSS__/loginRegister.css" />
	<style>
		.huoqu{border:none;outline: none;border-radius: 5px;}
	</style>
	</head>
	<body>
		<div class="l_main">
			<div class="logo">
				<a href="#">
					<img src="__IMG__/58.png" alt="" />
				</a>
			</div>
			
			<div class="l_content">
				<div class="l_content_l">
					<div class="l_content_lin">
						<div class="space5"></div>
						<div class="space2"></div>
						<div class="space2"></div>
						<a href="{:U('User/login')}" class="a_login">登陆</a> <a href="#" class="a_reg">注册</a>
						<div class="space2"></div>
						<form action="">
							<input type="text"  placeholder="请输入手机号" name='mobile' id='mobile' />
							<div class="space2"></div>
							<input type="text" placeholder="动态码" id='code' class="dongtai"/>
							<button href="javascript:;" class="huoqu" id='send'> 获取动态码</button>
							<div class="space2"></div>
							<input type="password" id='password'  placeholder="设置密码"/>
							<div class="space2"></div>
							<input type="password"  id='repassword' placeholder="再次确认密码"/>
							<div class="space2"></div>
							<a href="javascript:;" id='register' class="reg_sub">立即注册</a>
						</form>
						<div class="space1"></div>
						<div class="space2"></div>
						<input type="checkbox" /> <span class="xieyi"><a href="#">我已阅读并同意《用户注册协议》</a></span>
						<div class="space2"></div>
					</div>
				</div>
				<div class="l_content_m"></div>
				<div class="l_content_r">
					<div class="space5"></div>
					<div class="space5"></div>
					<div class="space2"></div>
					<div class="space2"></div>
					<p class="p_r1">使用合作账号登陆</p>
					<div class="space2"></div>
					<div class="space2"></div>
					<a href="#"><img src="__IMG__/64.png" alt="" /></a>
					<div class="space2"></div>
					<a href="#"><img src="__IMG__/65.png" alt="" /></a>
					</div>
				</div>
			</div>
		</div>
		<include file='Public/commonfooter' />
		<script type="text/javascript">
				$('#send').on('click' , function(e){
					e.preventDefault();
					var mobile = $('#mobile').val();
					sendMessage(mobile ,1 , 
					setHandle);
				});

				function setHandle(){
					var step = 3;
		            $('#send').text('重新发送60');
		            var _res = setInterval(function()
		            {   
		                $("#send").attr("disabled", true);//设置disabled属性
		                $('#send').text('重新发送'+step);
		                step-=1;
		                if(step <= 0){
			                $("#send").removeAttr("disabled"); //移除disabled属性
			                $('#send').text('获取验证码');
			                clearInterval(_res);//清除setInterval
		                }
		            },1000);
				}

				$('#register').on('click' , function(e){
					var mobile = $('#mobile').val();
					var password = $('#password').val();
					var repassword = $('#repassword').val();
					var preg1 = /^1[3|4|5|6|7|8|9]\d{9}$/i;
					if( !preg1.test(mobile)){
						layer.msg('手机号格式错误');return;
					}
					var code = $('#code').val();
					if(code ==''){
						layer.msg('验证码不能为空');return;
					}
					var preg2 = /^[0-9a-zA-Z_,\.\*\!&]{6,15}$/;
					if(!preg2.test(password)){
						layer.msg('密码长度为6-16位，只能含有.*!&等特殊字符');return;
					}
					if(password != repassword){
						layer.msg("密码和重复密码不一致");return;
					}
					var url = '{:U("User/register")}';
					$.post(url , {username:mobile,password:password,repassword:repassword,code:code} , function(data){
						if(data.status){
							window.location.href = data.url ;
						}else{
							layer.msg(data.info);
						}
					},'json');
				});
		</script>
	</body>
</html>
